#ifndef CORE_PRIMITIVE_SAMPLE_H
#define CORE_PRIMITIVE_SAMPLE_H
#include "SampleBase.h"
#include "glad\glad.h"
#include "Types.h"
#include "Sphere.h"
#include "HitableList.h"
#include "ImageParam.h"
#include "Camera.h"
#include "Lambertian.h"
#include "Metal.h"
#include "Triangle.h"
#include "Disk.h"
#include "Box.h"
#include "Rectangle.h"
namespace RayTracer
{
	class PrimitiveSample : public SampleBase
	{
	public:
		PrimitiveSample() = default;
		~PrimitiveSample() = default;

		void Init();
		void Render();
		void ImGui();
		void ShutDown();
	private:
		vec3 RayColor(const Ray& ray, const Hitable& world, int depth);
	private:
		int curIndex;
		bool isGenerate;
		GLuint mTexHandle = 0;
		ImageParam mImageParam; // output image
		int samples_per_pixel = 10;
		int maxDepth = 5;
		bool isNormal = false;
		// scene
		HitableList world;
		std::shared_ptr<Sphere> floor;
		std::shared_ptr<Box> box;
		std::shared_ptr<Triangle> triangle;
		std::shared_ptr<XY_Rect> rect;
		std::shared_ptr<Disk> disk;

		std::shared_ptr<Lambertian> floorMat;
		std::shared_ptr<Lambertian> triangleMat;
		std::shared_ptr<Metal> rectMat;
		std::shared_ptr<Lambertian> diskMat;
		std::shared_ptr<Metal> boxMat;
		// camera
		Camera camera;
		vec3 lookfrom;
		vec3 lookat;
		float fov;
		
		// sky color
		vec3 upColor;
		vec3 downColor;

		vec3 triangleColor;
		vec3 rectColor;
		vec3 groundColor;
		vec3 diskColor;
		vec3 boxColor;
	};
}
#endif // !CORE_PRIMITIVE_SAMPLE_H
